#include <iostream>
#include <vector>
using namespace std;
#define up 0b0001
#define down 0b0010
#define left 0b0100
#define right 0b1000
int n, m;
vector<vector<int> >a;

bool go(int x, int y, int k){
    for (int i = 0; i < k; ++i) {
        if(a[x][y] & down) ++x;
        else return false;
    }
    for (int i = 0; i < k; ++i) {
        if(a[x][y] & right) ++y;
        else return false;
    }
    for (int i = 0; i < k; ++i) {
        if(a[x][y] & up) --x;
        else return false;
    }
    for (int i = 0; i < k; ++i) {
        if(a[x][y] & left) --y;
        else return false;
    }
    return true;
}

int main() {
    ios_base::sync_with_stdio(false); cin.tie(nullptr);
    int T = 0;
    while(cin >> n >> m){
        ++T;
        a.assign(n+1, vector<int>(n+1, 0));
        char ch; int x, y;
        while(m--){
            cin >> ch >> x >> y;
            if(ch == 'H'){
                a[x][y] ^= right;
                a[x][y+1] ^= left;
            }
            else{
                a[y][x] ^= down;
                a[y+1][x] ^= up;
            }
        }
        vector<int> ans(n+1, 0);
        for (int i = 1; i <= n; ++i) {
            for (int j = 1; j <= n; ++j) {
                for (int k = 1; k <=n; ++k)
                    if(go(i, j, k)) ++ans[k];
            }
        }
        if(T>1) cout << "\n**********************************\n\n";
        cout << "Problem #" << T << "\n\n";
        bool flg = true;
        for (int l = 1; l <= n; ++l) {
            if(ans[l]) {
                flg = false;
                cout << ans[l] << " square (s) of size " << l << "\n";
            }
        }
        if(flg) cout << "No completed squares can be found.\n";
    }
    return 0;
}
